import xlwt,xlrd
from xlutils.copy import copy
import os
class Goods_xls_title(object):
    def __init__(self,path):
        self.path=path
    def func(self,sheet_name,title_list):
        wt=xlwt.Workbook()
        sheet=wt.add_sheet(sheet_name)
        for i in range(len(title_list)):
            sheet.write(0,i,title_list[i])
        wt.save(self.path)    
if __name__ == '__main__':
    goods_title = ['商品ID','商品名称','商品价格','商品数量','商家ID']
    shopping_title=['商品ID','商品名称','商品价格','商品数量','商家ID','买家ID']
    buy_order_title=['商品ID','商品名称','商品价格','商品数量','商家ID','买家ID','收货人姓名','联系电话','收货地址','订单状态','下单时间','订单ID']
    over_order_title=['订单编号','商品ID','商品名称','商品价格','商品数量','商家ID','订单状态','用户留言']
    users_title=['用户ID','用户密码','角色']
    userinfo_title=['买家ID','姓名','联系方式','地址']
    d = os.path.dirname(__file__)
    parent_path = os.path.dirname(d)
    # file_goods_info_path = parent_path + '/data/goods_info.xls'
    # goods=Goods_xls_title(file_goods_info_path)
    # goods.func('商品信息',goods_title)
    file_shopping_car_path = parent_path + '/data/shopping_car.xls'
    car=Goods_xls_title(file_shopping_car_path)
    car.func('购物车',shopping_title)
    # file_buy_order_path = parent_path + '/data/buy_order.xls'
    # buy=Goods_xls_title(file_buy_order_path)
    # buy.func('买家订单',buy_order_title)
    # file_sell_order_path = parent_path + '/data/sell_order.xls'
    # sell=Goods_xls_title(file_sell_order_path)
    # sell.func('卖家订单',sell_order_title)
    # file_over_order_path = parent_path + '/data/over_order.xls'
    # over=Goods_xls_title(file_over_order_path)
    # over.func('订单记录',over_order_title)
    # file_buy_user_path = parent_path + '/data/users.xls'
    # buy_user=Goods_xls_title(file_buy_user_path)
    # buy_user.func('用户账号密码',users_title)
    # file_buy_user_info_path = parent_path + '/data/userinfo.xls'
    # buy_user_info=Goods_xls_title(file_buy_user_info_path)
    # buy_user_info.func('用户信息',userinfo_title)





    